package client;


import java.io.Serializable;
import java.util.Random;

/**
 * @author Rob
 *
 */
@SuppressWarnings({ "serial", "rawtypes" })
public class Wallet implements Comparable, Serializable {
	private String owner;
	private int money;

	/**
	 * Create random values for Wallet
	 */
	public Wallet() {
		Random random = new Random();
		this.money = random.nextInt(1000);

		int nameLength = 1+random.nextInt(15);
		for(int i = 0; i<nameLength; i++) {
			String wordString = "";
			int stringLength = 1+random.nextInt(15);
			for(int j = 0; j<stringLength;j++){
				int minAndMaxCharacter = 66+ random.nextInt(25);
				wordString += (char)minAndMaxCharacter;
			}
			this.owner = wordString;
		}
	}

	/**
	 * Compare the Wallet to other wallets.
	 * @param o	The other object
	 * @return The result of the compare.
	 */
	@Override
	public int compareTo(Object o) {
		if (o instanceof Wallet) {
			Wallet obj = (Wallet) o;
			return this.owner.compareTo(obj.getOwner());
		}
		return -1;
	}
	
	/**
	 * return the owner
	 * @return	owner
	 */
	public String getOwner() {
		return this.owner;
	}
}
